const path = require('path')

module.exports = {
    runtimeCompiler: true,
    publicPath: './',
    lintOnSave: false,
    productionSourceMap: false,
    devServer: {
        port: 9110,             
        host: '127.0.0.1',
        https: false,
        open: true,           
        disableHostCheck: true,
        proxy: {                
            '/api': {
                target: 'http://127.0.0.1:8888',
                ws: false,
                changeOrigin: true,
                pathRewrite: {
                    '^/api': '/api'
                }
            }
        }
    },
    chainWebpack: config => {
        const dir = path.resolve(__dirname, 'src/assets/icons')
        config.module
            .rule('svg-sprite')
            .test(/\.svg$/)
            .include.add(dir).end()
            .use('svg-sprite-loader').loader('svg-sprite-loader').options({ extract: false }).end()
        config.plugin('svg-sprite').use(require('svg-sprite-loader/plugin'), [{ plainSprite: true }])
        config.module.rule('svg').exclude.add(dir) //排除icons目录的其他svg

    },
}